package com.shruijin.wy.thread.config;

import com.shruijin.wy.thread.MathRunnable;
import com.shruijin.wy.thread.SimpleRunnable;
import com.shruijin.wy.thread.SimpleThread;
import com.shruijin.wy.thread.tl.SimpleFilter;
import com.shruijin.wy.thread.action.MathAction;
import com.shruijin.wy.thread.action.SimpleAction;
import com.shruijin.wy.thread.cas.CasThread;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SimpleConfig {

    @Bean
    public SimpleThread initThread(){
        SimpleThread simpleThread2 = new SimpleThread();
        return simpleThread2;
    }

    @Bean
    public SimpleRunnable initRunnable(){
        SimpleRunnable simpleRunnable2 = new SimpleRunnable();
        return simpleRunnable2;
    }

    @Bean
    public MathRunnable initMathRunnable(){
        MathRunnable mathRunnable = new MathRunnable();
        return mathRunnable;
    }

    @Bean
    public CasThread initCasThread(){
        CasThread casThread = new CasThread();
        return casThread;
    }


    @Bean(name = "action.simple")
    public SimpleAction initAction(){
        SimpleAction simpleAction = new SimpleAction();
        return simpleAction;
    }

    @Bean(name = "action.math")
    public MathAction initMathAction(){
        MathAction mathAction = new MathAction();
        return mathAction;
    }

    @Bean
    public FilterRegistrationBean initFilter(){
        FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
        filterRegistrationBean.setFilter(new SimpleFilter());
        filterRegistrationBean.addUrlPatterns("/threadtest/*");
        return filterRegistrationBean;
    }

}
